home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 49 / Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso / -serious- / misc / football / user / viewscheduleandresults.rexx < prev    next >
OS/2 REXX Batch file  |  1999-11-29  |  4KB  |  174 lines

  1. /* Mode=Run */
  2. /* ***********************************************************************
  3.  
  4.    VIEW SCHEDULE PROGRAM FOR FOOTBALL REXX SUITE
  5.   -----------------------------------------------
  6.                    Copyright  Mark Naughton 1997
  7.  
  8.  
  9. Version    Date     History
  10. --------------------------------------------------------------------------
  11.  1.0       150997   First release.
  12.            151297   Tidied display.
  13.            180499   Amended display, in line with Results.
  14.            250499   And again.
  15.            250899   Added error msg for file checks.
  16.            110999   Converted to use locale. Some error messages, before
  17.                     reading the locale, will still be in English.
  18.  
  19. **************************************************************************
  20.  
  21. Procedure
  22. ---------
  23.  
  24. 1. Check files exist.
  25. 2. Open '.df' file and get the schedule definition file. Set marker.
  26. 3. If no file specified, then exit, giving an error.
  27. 2. Open file and print all lines without '*' with the exception of
  28.    the league name, weeks and dates which are underlined.
  29. 3. Close file and exit.
  30.  
  31. ************************************************************************** */
  32. PARSE ARG league_file
  33.  
  34. version     = 1
  35. league_file = "Data/" || league_file
  36. input_file  = '.sf'
  37. input2_file = '.df'
  38. autosched   = '*AUTOSCHD='
  39. separator   = '*'
  40.  
  41. if open(datafile,"Data/Football.locale",'r') then do
  42.    line = readln(datafile)
  43.    locdir = strip(line)
  44.    close(datafile)
  45. end
  46. else do
  47.    say
  48.    say "ERROR :    (ViewScheduleAndResults)"
  49.    say
  50.    say "Cannot read 'Data/Football.locale' for the locale settings."
  51.    exit
  52. end
  53.  
  54. locdir = locdir"User/ViewScheduleAndResults.data"
  55.  
  56. if open(datafile,"ENV:FootballRXPath",'r') then do
  57.    line = readln(datafile)
  58.    rxdir = strip(line)
  59.    close(datafile)
  60. end
  61. else
  62.    rxdir = "SYS:Rexxc/"
  63.  
  64. if exists(locdir) > 0 then do
  65.   address command rxdir'rx 'locdir
  66.   VarCount = getclip('VarCount')
  67.   do i = 1 to VarCount
  68.     interpret getclip('var.'i)
  69.   end
  70. end
  71. else do
  72.    say
  73.    say "ERROR :    (ViewScheduleAndResults)"
  74.    say
  75.    say "Cannot find '"locdir"' to read locale settings."
  76.    exit
  77. end
  78.  
  79. if exists(league_file || input_file) = 0  then do
  80.    say
  81.    say vsar_error
  82.    say
  83.    say vsar_t1"'"league_file || input_file"'."
  84.    exit
  85. end
  86.  
  87. if exists(league_file || input2_file) = 0  then do
  88.    say
  89.    say vsar_error
  90.    say
  91.    say vsar_t1"'"league_file || input2_file"'."
  92.    exit
  93. end
  94.  
  95. autos = 0
  96. if open(datafile,league_file || input2_file,'r') then do
  97.    do while ~eof(datafile)
  98.       line = readln(datafile)
  99.       if pos(autosched,line) > 0 then do
  100.          autofile = delstr(line,1,10)
  101.          autos = 1
  102.       end
  103.    end
  104.    close(datafile)
  105. end
  106. else do
  107.    say
  108.    say vsar_error
  109.    say
  110.    say vsar_t2"'"league_file||input2_file"'"vsar_t3
  111.    exit
  112. end
  113.  
  114. if autos = 0 then do
  115.    say
  116.    say vsar_error
  117.    say
  118.    say vsar_t4
  119.    say vsar_t5
  120.    say vsar_t6
  121.    say
  122.    exit
  123. end
  124.  
  125. if open(datafile,league_file || input_file,'r') then do
  126.    say
  127.    say center(vsar_t7,78)
  128.    say "-------------------------------------------------------------------------------"
  129.    say
  130.    say vsar_t8" '"autofile"' "vsar_t9
  131.    say
  132.    do while ~eof(datafile)
  133.       line = readln(datafile)
  134.       if pos(separator,line) = 0 then do
  135.          t1 = right(strip(substr(line,1,30)),30,' ')
  136.          say t1||substr(line,31)
  137.       end
  138.       else do
  139.          if words(line) > 1 then do
  140.             if pos("*Week",line) > 0 then do
  141.                chas = subword(line,2)
  142.                do mm=1 to length(chas)
  143.                   if substr(chas,mm,1) = "0" then
  144.                      chas = overlay(" ",chas,mm,1)
  145.                   else
  146.                      leave
  147.                end
  148.                chas = vsar_t10" "strip(chas)
  149.             end
  150.             else
  151.                chas = subword(line,2)
  152.             say chas
  153.             uline = ''
  154.             do i=1 to length(chas)
  155.                uline = insert('-',uline,i,1)
  156.             end
  157.             say strip(uline)
  158.          end
  159.          else
  160.             if words(line) = 1 then
  161.                say
  162.       end
  163.    end
  164.    say "-------------------------------------------------------------------------------"
  165.    close(datafile)
  166. end
  167. else do
  168.    say
  169.    say vsar_error
  170.    say
  171.    say vsar_t2"'"league_file||input_file"'"vsar_t3
  172. end
  173.  
  174. exit